import { defHttp } from '@/utils/http/axios';

enum Api {
  list = '/freight/fee/page',
  save = '/freight/fee/save/template',
  get = '/freight/fee/get',
  saveFeeRule = '/freight/fee/save/fee/rule',
  removeFeeRule = '/freight/fee/remove/fee/rule',
  saveFeeIncludedRule = '/freight/fee/save/included/rule',
  removeFeeIncludedRule = '/freight/fee/remove/included/rule',
}
/**
 * 保存或者更新
 * @param params
 */
export const get = (id, params = {}) => {
  return defHttp.get({ url: Api.get + `/${id}`, params });
};
/**
 * 保存或者更新
 * @param params
 */
export const list = (params) => {
  return defHttp.get({ url: Api.list, params });
};
/**
 * 保存或者更新
 * @param params
 */
export const saveOrUpdate = (params) => {
  return defHttp.post({ url: Api.save, params });
};
/**
 * 保存或者更新
 * @param params
 */
export const saveOrUpdateFeeRule = (params) => {
  return defHttp.post({ url: Api.saveFeeRule, params });
};
/**
 * 保存或者更新
 * @param params
 */
export const saveOrUpdateFeeIncludedRule = (params) => {
  return defHttp.post({ url: Api.saveFeeIncludedRule, params });
};
/**
 * 保存或者更新
 * @param params
 */
export const removeFeeRule = (id, params = {}) => {
  return defHttp.delete({ url: Api.removeFeeRule + `/${id}`, params });
};
/**
 * 保存或者更新
 * @param params
 */
export const removeFeeIncludedRule = (id, params = {}) => {
  return defHttp.delete({ url: Api.removeFeeIncludedRule + `/${id}`, params });
};
